#include <stdio.h>
#include <string.h>

int map[28][28];
int p,q,pq; // p for char, q for number 
int record[900][2];
int an[900][2];
int step;
int movex[]={-2,-2,-1,-1,+1,+1,+2,+2};
int movey[]={-1,+1,-2,+2,-2,+2,-1,+1};
int finish;

void walk(int x,int y)
{
	int tox,toy,i;

	if (finish) return;
	record[++step][0]=x;
	record[step][1]=y;
	if (step==pq) 
	{
		finish=1;
		for (i=1;i<=step;i++)
		{
			an[i][0]=record[i][0];
			an[i][1]=record[i][1];
		}
		return;
	}
	for (i=0;i<8;i++)
	{
		tox=x+movex[i];
		toy=y+movey[i];
		if (tox>=1 && tox<=p && toy>=1 && toy<=q && map[tox][toy]==0)
		{
			map[tox][toy]=1;
			walk(tox,toy);
			map[tox][toy]=0;
		}
			
	}
	step--;
}


main()
{
	int icase=0, ncase,i;

	scanf("%d", &ncase);
	while( ncase-->0 )
	{
		scanf("%d%d", &q, &p); //故意读反的
		memset(map,0,sizeof(map));
		step=0;	
		map[1][1]=1;
		finish=0;
		pq=p*q;
		walk(1,1);
		printf("Scenario #%d:\n", ++icase);
		if (finish==0) printf("impossible\n\n");
		else
		{
			for (i=1;i<=pq;i++)
				printf("%c%d",an[i][0]+'A'-1,an[i][1]);
			printf("\n\n");
		}


		
		
	}

	return 0;
}